package com.inno.subject.infra.basic.service.impl;

import com.inno.subject.infra.basic.entity.PlannerSubjectAnswer;
import com.inno.subject.infra.basic.mapper.PlannerSubjectAnswerDao;
import com.inno.subject.infra.basic.service.PlannerSubjectAnswerService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;


/**
 * (PlannerSubjectAnswer)表服务实现类
 *
 * @author makejava
 * @since 2024-12-01 09:56:07
 */
@Service("plannerSubjectAnswerService")
public class PlannerSubjectAnswerServiceImpl implements PlannerSubjectAnswerService {
    @Resource
    private PlannerSubjectAnswerDao plannerSubjectAnswerDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public PlannerSubjectAnswer queryById(Long id) {
        return this.plannerSubjectAnswerDao.queryById(id);
    }


    /**
     * 新增数据
     *
     * @param plannerSubjectAnswer 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerSubjectAnswer insert(PlannerSubjectAnswer plannerSubjectAnswer) {
        this.plannerSubjectAnswerDao.insert(plannerSubjectAnswer);
        return plannerSubjectAnswer;
    }

    /**
     * 修改数据
     *
     * @param plannerSubjectAnswer 实例对象
     * @return 实例对象
     */
    @Override
    public PlannerSubjectAnswer update(PlannerSubjectAnswer plannerSubjectAnswer) {
        this.plannerSubjectAnswerDao.update(plannerSubjectAnswer);
        return this.queryById(plannerSubjectAnswer.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.plannerSubjectAnswerDao.deleteById(id) > 0;
    }

    @Override
    public PlannerSubjectAnswer queryBySubjectId(Long id) {
        return this.plannerSubjectAnswerDao.queryBySubjectId(id);
    }
}
